Operating System Interface

KCL provides the following facilities that are not defined in the Common Lisp Reference Manual.



save filename[Function]

save saves the current memory image into a program file filename. After saving the memory image, the KCL process terminates immediately. To execute the saved program file, specify the full pathname of the file, as indicated in the example below.



———— Note to KCL/AOS users ————



In KCL/AOS, if the filename does not contain the filetype .pr, then the program file is given the name filename .pr. Also save saves a symbol table file with the filetype .st. When the program file is executed, execution begins at the top-level of KCL. Even if there were streams that were open at the call of save, these streams are not effective when the program file is executed. The function save of KCL/AOS does not terminate the KCL process.



———— End of Note ———–



Example:

        >(defun plus (x y) (+ x y))
        plus

        >(save ``savefile'')
        %

        % pwd
        /usr/hagiya
        % /usr/hagiya/savefile

        >(plus 2 3)
        5

        >(bye)
        Bye.
        %

———— Note to KCL/AOS users ————



Here is the example of save in KCL/AOS.

        >(defun plus (x y) (+ x y))
        plus

        >(save ``savefile'')
        t

        >(bye)
        Bye.
        )

        ) X SAVEFILE

        >(plus 2 3)
        5

        >(bye)
        Bye.
        )

———— End of Note ————



system string[Function]

Executes a Shell command as if string is an input to the Shell. On return from the Shell command, system returns the exit code of the command as an integer.



———— Note to KCL/AOS users ————



This function is not supported in KCL/AOS. Use instead those functions specific to KCL/AOS described below.



———— End of Note ————



bye &optional exit-code[Function]
by &optional exit-code[Function]

Terminates KCL and returns the exit-code to the parent process. exit-code must be an integer and its default value is 0 .



———— Note to KCL/AOS users ————


The functions bye and by of KCL/AOS accept a string instead of an exit-code. If string is supplied, these functions return the string to the father as the termination message.



———— End of Note ————


The following functions process, termination-message, and last-termination-message are specific to KCL/AOS and are not supported in KCL on Unix.



process progname &optional ipc-message[Function]

        \&key    :block :console :debug :dir
                 :input :output :username
                 :list :data :ioc
This function is defined only in KCL/AOS. process creates a process in the way specified by its arguments.

progname
The name of the process to create. Must be a string.
ipc-message
The IPC message passed to the process. Must be a string. Arguments in the message must be separated with commas ' , '.

:block
If non- nil, KCL blocks its execution while the son executes. Defaults to t.

:console
The name of the file to be associated to @console. Must be a string. No file is associated if :console is not specified and if the :ioc argument (see below) is specified with a non-nil value. :console supercedes :ioc.

:debug
If non-nil, the son runs in the debug mode.

:input
The name of the file to be associated to @input. Must be a string. No file is associated if :input is not specified and if the :ioc argument (see below) is specified with a non-nil value. :input superceds :ioc.

:output
The name of the file to be associated to @output. Must be a string. No file is associated if :output is not specified and if the :ioc argument (see below) is specified with a non-nil value. :output supercedes :ioc.

:username
The user-name of sub-process. Must be a string. If not specified, the current user-name is used.

:list
If a string, the name of the file to be associated to @list. If t, the file currently associated to @list is used. If nil, or if not specified, no list file is passed to the son.

:data
If a string, the name of the file to be associated to @data. If t, the file currently associated to @data is used. If nil, or if not specified, no data file is passed to the son.

:ioc
If non-nil, current @input, @output, and @console files are passed to the son. If not specified, these files are not passed unless specified by the :console, :input, or :output arguments.

Example:

        >(process ``:cli.pr'')

        AOS/VS CLI  REV 03f.03.00.00   19-APRIL-84   12:00:00
        )by
        AOS/VS CLI  TERMINATING        19-APRIL-84   12:00:00
        t

        >

termination-message[Function]

This function is defined only in KCL/AOS. termination-message returns a string consisting of the termination message of a son. Used in connection with the function process.

last-termination-message[Function]

This function is defined only in KCL/AOS. last-termination-message flushes all the messages currently spooled and returns the last termination message.